package  
{
	import flash.display.Sprite;
	/**
	 * ...
	 * @author Team Izanami
	 */
	public class Grip extends Sprite// Le grip forcera à suivre une droite prédéterminée
	{
		private var _posX:int = new int();
		private var _posY:int = new int();
		private var _a:int = new int();	// Equation de la forme y = ax + b
		private var _b:int = new int();	//
		private var _xMaximal:int = 100;
		private var _finPousse:Boolean = false; // Indique si le joueur a quitté le grip
		private var _direction:String = new String();
		
		
		//***************
		// ACCESSORS
		//***************
		
		public function returnPosX():int
		{
			return _posX;
		}
		
		public function returnPosY():int
		{
			return _posY;
		}
		
		public function returnPosXMaximal():int
		{
			return _xMaximal;
		}
		
		public function returnDirection():String
		{
			return _direction;
		}
		
		//***************
		// METHODS
		//***************
		
		public function Grip(positionX:int, positionY:int, a:int, b:int, positionXMaximal:int, direction:String) 
		{
			_posX = positionX;
			_posY = positionY;
			_a = a;
			_b = b - positionX;
			_xMaximal = positionXMaximal;
			_direction = direction;
		}
		
		public function determineY(posX:int):int
		{
			trace (_a * posX + _b)
			if (_a != 0)
			{
				return (0 - (_a *posX + _b) + _posY);
			}
			else 
			{
				return _posY;
			}
		}
		
		public function estAuBout(posX:int):Boolean
		{
			if (posX > _xMaximal)
			return true;
			else
			return false;
		}
		
	}

}